#include "BulletF.h"
#include "RSManager.h"
#include "Sprite.h"
#include "Box.h"
#include <math.h>
BulletF::BulletF(void):Bullet()
{
	_id = B_F;
}


BulletF::~BulletF(void)
{
}

void BulletF::init()
{
	_sprite = RSManager::getInstance()->getSprite(SPRITE_ID::BM);
	_box->_size =  _sprite->getRenderSize();
	this->AssignMove(_box);
	angleF = 0;
}

void BulletF::update()
{
	float sign = cos(_angle) < 0 ? 1.0f:-1.0f;
	this->angleF += 0.5f;
	if(this->angleF >= 2*3.14f)
		this->angleF = 0;
	_box->_position.x += cos(angleF) * 15.0f;	
	_box->_position.y += 10 * sin(angleF * sign);	
	moveFollowAngle(_angle);		
}

void BulletF::render()
{
	_sprite->Render(_box->_position);
	D3DXVECTOR2 p1 = _box->_position;	
	p1.y -= 2;
	_sprite->Render(p1);
	p1.x += 4;	
	_sprite->Render(p1);
}
